﻿@inject BingWallpaperService BingWallpaperService
@{Layout = null;}

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Login | Admin</title>
    <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
    <link rel="stylesheet" href="~/css/home/index.min.css" />

    <script type="text/javascript" src="~/lib/jquery/dist/jquery.min.js"></script>
    <script type="text/javascript" src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>

    @switch (ViewBag.Theme.ThemeType)
    {
        case ThemeType.Auto:
            @if (DateTime.Now.Hour > 18 || DateTime.Now.Hour < 7)
            {
                <script type="text/javascript" src="~/lib/darkreader/darkreader.min.js"></script>
                <script>DarkReader.setFetchMethod(window.fetch); DarkReader.enable();</script>
            }
            break;

        case ThemeType.White:
            break;

        case ThemeType.Black:
            <script type="text/javascript" src="~/lib/darkreader/darkreader.min.js"></script>
            <script>DarkReader.setFetchMethod(window.fetch); DarkReader.enable();</script>
            break;
    }

</head>
<body>

    <div id="imgbg" style="background-image:url('@await BingWallpaperService.GetUrl()');">
        <div id="content">

            <img id="user" src="@OssService.GetAvatar()" />

            <div id="loginCarousel" class="carousel slide pl-4 pr-4" data-ride="carousel" data-interval="false">
                <div class="carousel-inner">

                    <div class="carousel-item">
                        <h4>Login with Password</h4>
                        <form method="post" asp-controller="home" asp-action="VerifyPassword" asp-route-Redirect=@(Context.Request.Query["Redirect"])>
                            <div class="form-group pt-2">
                                <input name="pwd" type="password" class="form-control" placeholder="Enter the password" />
                            </div>

                            <button type="submit" class="btn btn-dark" onclick="changeLoginFunc(0)">Login</button>
                        </form>
                    </div>

                    <div class="carousel-item">
                        <h4>Login with verification code</h4>
                        <form method="post" asp-controller="home" asp-action="VerifyPassword" asp-route-Redirect=@(Context.Request.Query["Redirect"])>
                            <button id="btn_login" type="button" class="btn btn-dark mt-2" onclick="login()">Get verification code</button>
                            <div class="form-group mt-3">
                                <input name="pwd" type="password" class="form-control" placeholder="Enter the verification code" />
                            </div>

                            <button type="submit" class="btn btn-dark" onclick="changeLoginFunc(1)">Login</button>
                        </form>
                    </div>

                </div>

                <a class="carousel-control-prev" href="#loginCarousel" role="button" data-slide="prev">
                    <svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" fill="black" class="bi bi-chevron-compact-left" viewBox="0 0 16 16">
                        <path fill-rule="evenodd" d="M9.224 1.553a.5.5 0 0 1 .223.67L6.56 8l2.888 5.776a.5.5 0 1 1-.894.448l-3-6a.5.5 0 0 1 0-.448l3-6a.5.5 0 0 1 .67-.223z" />
                    </svg>
                </a>

                <a class="carousel-control-next" href="#loginCarousel" role="button" data-slide="next">
                    <svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" fill="black" class="bi bi-chevron-compact-right" viewBox="0 0 16 16">
                        <path fill-rule="evenodd" d="M6.776 1.553a.5.5 0 0 1 .671.223l3 6a.5.5 0 0 1 0 .448l-3 6a.5.5 0 1 1-.894-.448L9.44 8 6.553 2.224a.5.5 0 0 1 .223-.671z" />
                    </svg>
                </a>
            </div>

            <footer>
                <hr />
                <p>&copy; @DateTime.Now.Year - @ViewBag.Profile.Name</p>
            </footer>

        </div>
    </div>

    <script type="text/javascript" src="~/js/home/index.min.js"></script>

</body>
</html>
